function [a,b,c,d,e]=homework4driver()

largenumber=5;
power=[1 5 10 20 40 80 320 1000];
%power=[1 4];
a=zeros(length(power),4);
b=zeros(length(power),4);
c=zeros(length(power),4);
d=zeros(length(power),4);
e=zeros(length(power),4);
for p=1:length(power)
a_temp=0;
b_temp=0;
c_temp=0;
d_temp=0;
e_temp=0;
for k=1:largenumber
	[a1,b1,c1,d1,e1]=homework4([1 2 3 4 5], power(p));
	a_temp=a_temp+a1;
	b_temp=b_temp+b1;
	c_temp=c_temp+c1;
	d_temp=d_temp+d1;
	e_temp=e_temp+e1;
end

a(p,:)=a_temp;
b(p,:)=b_temp;
c(p,:)=c_temp;
d(p,:)=d_temp;
e(p,:)=e_temp;
end

a=1-a/largenumber;
b=1-b/largenumber;
c=1-c/largenumber;
d=1-d/largenumber;
e=1-e/largenumber;

%save homework4alldata
load homework4alldata


power=[1 5 10 20 40 80 320 1000];

x=power;

col=1;
figure;
plot(log(x),a(:,col)','b.-',log(x),b(:,col)','c.-',log(x),c(:,col)','r.-',log(x),d(:,col)','m.-',log(x),e(:,col)','g.-');
ylabel('Bit Error Rate');
xlabel('log SNR (dB)');
legend('Max Rate', 'Equal-SNR', 'Linear MMSE', 'Whitening', 'BLAST');
title('BER rate vs log SNR(dB) for Correlated, Known Channel');

col=2;
figure;
plot(log(x),a(:,col)','b.-',log(x),b(:,col)','c.-',log(x),c(:,col)','r.-',log(x),d(:,col)','m.-',log(x),e(:,col)','g.-');
ylabel('Bit Error Rate');
xlabel('log SNR (dB)');
legend('Max Rate', 'Equal-SNR', 'Linear MMSE', 'Whitening', 'BLAST');
title('BER rate vs log SNR(dB) for Uncorrelated, Known Channel');

col=3;
figure;
plot(log(x),a(:,col)','b.-',log(x),b(:,col)','c.-',log(x),c(:,col)','r.-',log(x),d(:,col)','m.-',log(x),e(:,col)','g.-');
ylabel('Bit Error Rate');
xlabel('log SNR (dB)');
legend('Max Rate', 'Equal-SNR', 'Linear MMSE', 'Whitening', 'BLAST');
title('BER rate vs log SNR(dB) for Correlated, Estimated Channel');

col=4;
figure;
plot(log(x),a(:,col)','b.-',log(x),b(:,col)','c.-',log(x),c(:,col)','r.-',log(x),d(:,col)','m.-',log(x),e(:,col)','g.-');
ylabel('Bit Error Rate');
xlabel('log SNR (dB)');
legend('Max Rate', 'Equal-SNR', 'Linear MMSE', 'Whitening', 'BLAST');
title('BER rate vs log SNR(dB) for Uncorrelated, Estimated Channel');
